package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 小懒虫
 * @date 2018/8/14
 */
@Data
@Entity
@Table(name = "pcs_dep") // 修改: pcs_contract_tpl -> pcs_dep
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_dep" + StatusUtil.SLICE_DELETE) // 修改: pcs_contract_tpl -> pcs_dep
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("科室数据") // 修改: 合同模板数据 -> 科室数据
public class Dep implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @Excel("科室名称")
    private String name; // 新增字段

    @Excel("科室类别编号 \"1\", \"门诊科室\" \"2\", \"收款处\" \"3\", \"病房\" \"4\", \"药房\" \"5\", \"药库\" \"6\", \"医技科室\" \"7\", \"手术室\" \"8\", \"行政科室\" \"9\",\"护理单元\" \"10\",\"静配中心\" \"11\",\"机构\"")
    private String categoryId;

    @Excel("科室ID")
    private String deptId;

    @CreatedDate
    @Excel("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @JsonIgnore
    private Byte status = StatusEnum.OK.getCode();
}
